package com.edu.marker.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class Prefs {
	public static void setStrValue(final Editor editor, String key,
			String value) {
		editor.putString(key, value).commit();
	}
	
	public static String getStrValue(Context context, String key,String defaultValue) {
		final SharedPreferences shpfs = PreferenceManager.getDefaultSharedPreferences(context);
		return shpfs.getString(key, defaultValue);
	}
	
	public static void setIntValue(final Editor editor, String key,
			int value) {
		editor.putInt(key, value).commit();
	}
	
	public static void setBoolValue(final Editor editor, String key,
			boolean value) {
		editor.putBoolean(key, value).commit();
	}
	
	public static int getIntValue(Context context, String key) {
		final SharedPreferences shpfs = PreferenceManager.getDefaultSharedPreferences(context);
		return shpfs.getInt(key, 0);
	}
}
